﻿@model DiarySocial.ViewModels.DiaryPost
@{
    ViewBag.Title = "Post";
}
@Styles.Render("~/Content/themes/scale/nestable")
<section class="hbox stretch">
    <section class="vbox">
        <section class="scrollable wrapper" id="text-wraper">
            @using (Ajax.BeginForm(new AjaxOptions
            {
                HttpMethod = "Post",
                UpdateTargetId = "text-wraper",
                InsertionMode = InsertionMode.Replace
            }))
            {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary()
                <textarea name="@Html.NameFor(m => m.Body)" id="Body" class="hidden"></textarea>
                <div class="form-group row m-b">
                    <div class="col-lg-9 col-md-8 col-sm-12 col-xs-12">
                        <div class="btn-toolbar m-b-sm btn-editor" data-role="editor-toolbar" data-target="#editor">
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" title="Font"><i class="fa fa-font"></i><b class="caret"></b></a>
                                <ul class="dropdown-menu"></ul>
                            </div>
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" title="Font Size"><i class="fa fa-text-height"></i>&nbsp;<b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    <li><a data-edit="fontSize 5"><font size="5">Huge</font></a></li>
                                    <li><a data-edit="fontSize 3"><font size="3">Normal</font></a></li>
                                    <li><a data-edit="fontSize 1"><font size="1">Small</font></a></li>
                                </ul>
                            </div>
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" data-edit="bold" title="Bold (Ctrl/Cmd+B)"><i class="fa fa-bold"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="italic" title="Italic (Ctrl/Cmd+I)"><i class="fa fa-italic"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="strikethrough" title="Strikethrough"><i class="fa fa-strikethrough"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="underline" title="Underline (Ctrl/Cmd+U)"><i class="fa fa-underline"></i></a>
                            </div>
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" data-edit="insertunorderedlist" title="Bullet list"><i class="fa fa-list-ul"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="insertorderedlist" title="Number list"><i class="fa fa-list-ol"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="outdent" title="Reduce indent (Shift+Tab)"><i class="fa fa-dedent"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="indent" title="Indent (Tab)"><i class="fa fa-indent"></i></a>
                            </div>
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" data-edit="justifyleft" title="Align Left (Ctrl/Cmd+L)"><i class="fa fa-align-left"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="justifycenter" title="Center (Ctrl/Cmd+E)"><i class="fa fa-align-center"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="justifyright" title="Align Right (Ctrl/Cmd+R)"><i class="fa fa-align-right"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="justifyfull" title="Justify (Ctrl/Cmd+J)"><i class="fa fa-align-justify"></i></a>
                            </div>
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" title="Hyperlink"><i class="fa fa-link"></i></a>
                                <div class="dropdown-menu">
                                    <div class="input-group m-l-xs m-r-xs">
                                        <input class="form-control input-sm" placeholder="URL" type="text" data-edit="createLink" />
                                        <div class="input-group-btn">
                                            <button class="btn btn-default btn-sm" type="button">Add</button>
                                        </div>
                                    </div>
                                </div>
                                <a class="btn btn-default btn-sm" data-edit="unlink" title="Remove Hyperlink"><i class="fa fa-cut"></i></a>
                            </div>

                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" title="Insert picture (or just drag & drop)" id="pictureBtn"><i class="fa fa-picture-o"></i></a>
                                <input type="file" data-role="magic-overlay" data-target="#pictureBtn" data-edit="insertImage" title="Insert picture (or just drag & drop)" />
                            </div>
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" data-edit="undo" title="Undo (Ctrl/Cmd+Z)"><i class="fa fa-undo"></i></a>
                                <a class="btn btn-default btn-sm" data-edit="redo" title="Redo (Ctrl/Cmd+Y)"><i class="fa fa-repeat"></i></a>
                            </div>
                        </div>
                        <div id="editor" class="form-control" style="overflow:scroll;height:400px;max-height:600px" data-need-bind-value="true" data-target="#Body">
                        </div>
                    </div>
                    <div class="col-lg-3 col-md-4 col-sm-12 col-xs-12">
                        <div class="dd" id="category-nestable">
                            <ol class="dd-list">
                                <li class="dd-item dd3-item" data-id="1">
                                    <div class="dd-handle dd3-handle">Drag</div>
                                    <div class="dd3-content">
                                        <div class="checkbox i-checks">
                                            <label>
                                                <input type="checkbox" name="Categories" />
                                                <i></i>
                                                Category 1
                                            </label>
                                        </div>
                                    </div>
                                </li>
                                <li class="dd-item dd3-item" data-id="2">
                                    <div class="dd-handle dd3-handle">Drag</div>
                                    <div class="dd3-content">
                                        <div class="checkbox i-checks">
                                            <label>
                                                <input type="checkbox" name="Categories" />
                                                <i></i>
                                                Category 2
                                            </label>
                                        </div>
                                    </div>
                                </li>
                                <li class="dd-item dd3-item" data-id="3">
                                    <div class="dd-handle dd3-handle">Drag</div>
                                    <div class="dd3-content">
                                        <div class="checkbox i-checks">
                                            <label>
                                                <input type="checkbox" name="Categories" />
                                                <i></i>
                                                Category 3
                                            </label>
                                        </div>
                                    </div>
                                    <ol class="dd-list">
                                        <li class="dd-item dd3-item" data-id="4">
                                            <div class="dd-handle dd3-handle">Drag</div>
                                            <div class="dd3-content">
                                                <div class="checkbox i-checks">
                                                    <label>
                                                        <input type="checkbox" name="Categories" />
                                                        <i></i>
                                                        Category 4
                                                    </label>
                                                </div>
                                            </div>
                                        </li>
                                        <li class="dd-item dd3-item" data-id="5">
                                            <div class="dd-handle dd3-handle">Drag</div>
                                            <div class="dd3-content">
                                                <div class="checkbox i-checks">
                                                    <label>
                                                        <input type="checkbox" name="Categories" />
                                                        <i></i>
                                                        Category 5
                                                    </label>
                                                </div>
                                            </div>
                                        </li>
                                        <li class="dd-item dd3-item" data-id="6">
                                            <div class="dd-handle dd3-handle">Drag</div>
                                            <div class="dd3-content">
                                                <div class="checkbox i-checks">
                                                    <label>
                                                        <input type="checkbox" name="Categories" />
                                                        <i></i>
                                                        Category 6
                                                    </label>
                                                </div>
                                            </div>
                                        </li>
                                    </ol>
                                </li>
                            </ol>
                        </div>
                    </div>
                </div>
                <div class="form-group row m-b">
                    <div class="col-sm-4">
                        <button class="btn btn-info btn-sm" type="submit" onclick="onClickSubmit()">POST</button>
                        <div class="btn-group m-r">
                            <button data-toggle="dropdown" class="btn btn-sm btn-default dropdown-toggle">
                                <span class="dropdown-label">Friend</span>
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu dropdown-select">
                                <li class="">
                                    <a href="#">
                                        <i class="fa fa-globe"></i>
                                        <input type="radio" name="d-s-r">Public
                                    </a>
                                </li>
                                <li class="">
                                    <a href="#">
                                        <i class="fa fa-lock"></i>
                                        <input type="radio" name="d-s-r">Private
                                    </a>
                                </li>
                                <li class="active">
                                    <a href="#">
                                        <i class="fa fa-user"></i>
                                        <input type="radio" name="d-s-r" checked="">Friend
                                    </a>
                                </li>
                                <li class="disabled">
                                    <a href="#">
                                        <i class="fa fa-envelope-o"></i>
                                        <input type="radio" name="d-s-r" disabled>Invite
                                    </a>
                                </li>
                                <li class="disabled">
                                    <a href="#">
                                        <i class="fa fa-bullhorn"></i>
                                        <input type="radio" name="d-s-r" disabled>Anonymous
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            }
            <div id="result">

            </div>
        </section>
    </section>
</section>
@section Scripts {
    @Scripts.Render("~/bundles/wysiwyg")
    @Scripts.Render("~/bundles/nestable")
    <script type="text/javascript">
        function onClickSubmit() {
            $('#Body').html("Hello");
            $(this).submit();
            return false;
        };
        $(document).ready(function () {
            // activate Nestable for list 1
            $('#category-nestable').nestable();
            // fix insert image button width
            $('#pictureBtn:parent').css("overflow", "hidden");
        });
    </script>
}
